package com.abcgz.grade.config;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.shiro.authc.AuthenticationInfo;  
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authc.UsernamePasswordToken;  
import org.apache.shiro.authc.credential.SimpleCredentialsMatcher;  
import org.apache.shiro.crypto.hash.Sha384Hash;
import org.apache.shiro.subject.PrincipalCollection;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import com.abcgz.grade.dao.User;  
  
/** 
 * 自定义 密码验证类 
 * @author q 
 * 
 */  
public class CustomCredentialsMatcher extends SimpleCredentialsMatcher {  
	private static Logger logger = LoggerFactory.getLogger(CustomCredentialsMatcher.class);
	
	
     @Override  
    public boolean doCredentialsMatch(AuthenticationToken authcToken, AuthenticationInfo info) {  
 			UsernamePasswordToken token = (UsernamePasswordToken) authcToken;
 			SimpleAuthenticationInfo sinfo = (SimpleAuthenticationInfo)info;
 			PrincipalCollection principalsCollect = sinfo.getPrincipals();
            return equals(String.valueOf(token.getPassword()), getCredentials(sinfo));  
        }  
  
    
}  